/*
 * @Author: lusx 
 * @Date: 2020-04-22 11:11:59 
 * @Last Modified by: lusx
 * @Last Modified time: 2020-04-22 11:35:08
 */

import { observer } from "mobx-react";
import { WeaTab, WeaLocaleProvider } from 'ecCom';
import { Button } from 'antd';
import { Condition } from '../list/listCondition';
const getLabel = WeaLocaleProvider.getLabel;
@observer
class TabComponent extends React.Component {
    render() {
        const { contentStore, account } = this.props;
        const { showSearchAd, tasksubform } = contentStore;
        const formParams = tasksubform.getFormParams() || {};
        return (
            <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@wu1wr8`}
                buttonsAd={this.getAdButtons()}
                searchType={['base', 'advanced']}
                searchsBaseValue={formParams.taskname}
                setShowSearchAd={bool => { contentStore.setShowSearchAd(bool) }}
                hideSearchAd={() => contentStore.setShowSearchAd(false)}
                searchsAd={
                    <div><Condition ecId={`${this && this.props && this.props.ecId || ''}_Condition@961lbd`} listStore={contentStore} form={tasksubform}></Condition></div>
                }
                showSearchAd={showSearchAd}
                onSearch={v => { contentStore.getTaskSubList() }}
                onSearchChange={v => { contentStore.setFormFields({ taskname: { value: v } }) }}
            />
        )
    }
    getAdButtons = () => {
        const { contentStore } = this.props;
        const { getTaskSubList, setShowSearchAd, clearFormFields } = contentStore;
        return [
            (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@v8ecgo@search`} type="primary" onClick={() => { getTaskSubList(); setShowSearchAd(false); }}>{getLabel(197, "搜索")}</Button>),
            (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@qpz910@reset`} type="ghost" onClick={() => { clearFormFields(); }}>{getLabel(2022, "重置")}</Button>),
            (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ug9w8z@cancel`} type="ghost" onClick={() => { setShowSearchAd(false) }}>{getLabel(201, "取消")}</Button>)
        ];
    }
}
export { TabComponent }